package cn.com.generaldata.os.importpojo;

import java.util.HashSet;
import java.util.Set;

import javax.xml.bind.annotation.XmlTransient;

import com.sun.xml.internal.bind.CycleRecoverable;

public class Role implements java.io.Serializable, CycleRecoverable {

	private static final long serialVersionUID = 5561960132304831709L;

	private String id; // 角色ID
	private String roleName; // 角色名
	private String roleDesc; // 角色描述
	private Set<User> users = new HashSet<User>(0);

	public Role() {
	}

	public Role(String id, String roleName) {
		this.id = id;
		this.roleName = roleName;
	}

	public Role(String id, String roleName, String roleDesc, Set<User> users) {
		this.id = id;
		this.roleName = roleName;
		this.roleDesc = roleDesc;
		this.users = users;
	}

	/**
	 * 解决CXF循环引用问题.
	 * 
	 * @param arg0
	 * @return
	 */
	@Override
	public Object onCycleDetected(Context arg0) {
		Role temp = new Role();
		temp.setId(id);
		return temp;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getRoleName() {
		return roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	public String getRoleDesc() {
		return roleDesc;
	}

	public void setRoleDesc(String roleDesc) {
		this.roleDesc = roleDesc;
	}

	@XmlTransient
	public Set<User> getUsers() {
		return users;
	}

	public void setUsers(Set<User> users) {
		this.users = users;
	}

}
